<?php 

class AddFileForm extends My_Form
{
	protected $fileDecorator = array(
		'ViewHelper',
		'Errors',
		array('HtmlTag', array('tag' => 'div', 'class' => 'formFileField')),
		'Label'
	);
	
	public function __construct($iId = null) {
	    $sBaseUrl = Zend_Registry::get('baseUrl');
		
		parent::__construct();
		
		$this->setAction($sBaseUrl.'/ftp/addfile')
				->setMethod('post')
				->setAttrib('enctype', 'multipart/form-data');
	    
	    $idRodzica = $this->createElement('hidden', 'id_rodzica', array('value' => $iId));
		$idRodzica->setDecorators($this->hiddenDecorator);
		$idRodzica->setRequired(true)
					->addValidator('digits');
	    
	    $file = $this->createElement('file', 'plik');	
		$file->setDecorators($this->fileDecorator);
		$file->setLabel("Dodaj plik: ");
	    //$file = new App_Form_Element_File('file');
	    $file->setRequired(true)
				->addValidator('NotEmpty');
	         
	
		$submit = $this->createElement('submit', 'submit', array('label' => 'Dodaj'));
		$submit->setDecorators($this->submitDecorator);
	    
	    $this->addElements(array($idRodzica, $file, $submit));
	}
}
?>